package com.xltt.vehicleControl.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.xltt.vehicleControl.R;
import com.xltt.vehicleControl.activity.LauncherActivity;
import com.xltt.vehicleControl.activity.LoginActivity;
import com.xltt.vehicleControl.base.BaseFragment;
import com.xltt.vehicleControl.base.BasePresenter;
import com.xltt.vehicleControl.util.NetWorkUtils;
import com.xltt.vehicleControl.util.SharedPreferencesUtils;
import com.xltt.vehicleControl.util.ToastUtil;

import butterknife.BindView;
import butterknife.OnClick;

public class VehicleSettingsFragment extends BaseFragment {
    @BindView(R.id.logout_btn)
    RelativeLayout mLogoutView;

    @Override
    public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.vehicle_settings_fragment, container, false);
    }


    @OnClick({R.id.logout_btn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.logout_btn:
                if(!NetWorkUtils.isAvailable(getActivity())){
                    ToastUtil.show(getActivity(),getString(R.string.please_connect_network_logout_tip));
                    return;
                }
                SharedPreferencesUtils.clearByKey(mContext, LoginActivity.REQUETS_PASSWORD);
                ((LauncherActivity)getActivity()).logout();
                break;
        }
    }

}
